<?php
namespace Jobs\Job\Tmp;

use OSS\OssClient;
use OSS\Core\OssException;
use OSS\Http\RequestCore;
use OSS\Http\ResponseCore;

class Request extends \Base\Jobs\Job {

    public function action($argv = array()) {
//
//        $signedUrl = 'http://myedutest.oss-cn-beijing.aliyuncs.com/2018-12-12/tGlfYwOdxMm4?OSSAccessKeyId=G6BengAWA35GGz0e&Expires=1544598660&Signature=uT2tlnIvWObWHcgcLl8FZml8Bg0=';
//
//        $content = "Hello OSS.";
//        $request = new \OSS\Http\RequestCore($signedUrl);
//// 生成的URL以PUT方式访问。
//        $request->set_method('PUT');
//        $request->add_header('Content-Type', '');
//        $request->add_header('Content-Length', strlen($content));
//        $request->set_body($content);
//        $request->send_request();
//        $res = new \OSS\Http\ResponseCore($request->get_response_header(),
//            $request->get_response_body(), $request->get_response_code());
//        if ($res->isOK()) {
//            print(": OK" . "\n");
//        } else {
//            print(": FAILED" . "\n");
//        };
//
//        $time = '1452504942126';
//        $time2 = substr($time,0,-3);
//        var_dump($time,$time2);exit;

//        $channel_id = '6207760637435905';
//        $ret = (new \Dao\Api\Netease\Vroom\Room())->members($channel_id);

//        echo date('Y-m-d H:i:s');
//        var_dump($ret);

//
//        $access_id = \S\Config::confServer('message.oss.access_id');
//        $secret = \S\Config::confServer('message.oss.access_key');
//        $res = (new \S\Msg\Message($access_id,$secret))->sendSms('爱特辅导','SMS_153100019',13069577316,array('code'=>'12345'));
//        var_dump($res);

//        $channel_id = '6331653630739001';
////        $ret = (new \Data\Netease\Room())->status($channel_id);
//        $ret = (new \Data\Netease\Room())->close($channel_id);
//        var_dump($ret);

    }


    /**
     * @name 获取当前的毫秒数
     * @return string
     */
    function msectime() {
        $time = microtime();
        list($msec, $sec) = explode(' ', $time);
        $msectime = sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000);
        return $msectime;
    }

    /**
     * @name 毫秒转日期
     * @param $time
     * @return string
     */
    function msecdate($time)
    {
        $tag='Y-m-d H:i:s';
        $a = substr($time,0,10);
        $b = substr($time,10);
        $date = date($tag,$a).'.'.$b;
        return $date;
    }

}